import { defineComponent, ref } from "vue";
import PageImgTitle from "@/components/PageImgTitle";
import CardView from "@/components/CardView";
import { getUserInfoUrl } from "@/command/apiTool";
import { IFilterMenuChoose } from "@/components/FilterMenu/types";
import ListView from "@/components/ListView";
import RequestRecordItem from "@/components/RequestRecordItem";
import FilterMenuSearch from "@/components/FilterMenuSearch";

export default defineComponent({
  name: "",
  setup() {
    const renderItem = (e: any) => {
      return <RequestRecordItem class={"w-full"} itemData={e} />;
    };
    const form = ref({});
    const render1 = () => {
      const data: IFilterMenuChoose[] = [
        { type: "area", key: "code" },
        { type: "packType", key: "packType", title: "包装类型" },
        { type: "datePicker", key: "date" },
      ];
      return (
        <CardView title="" radius={0}>
          <FilterMenuSearch
            choose={data}
            searchKey="name"
            modelValue={form.value}
          />
          <ListView
            {...getUserInfoUrl(
              {
                dh: "",
                xh: "/api/H5/sell/brand/small/applyHistoryList",
              },
              form.value
            )}
            type="page"
            renderItem={renderItem}
          />
        </CardView>
      );
    };
    return () => {
      return <PageImgTitle title="申请记录">{render1()}</PageImgTitle>;
    };
  },
});
